//
//  SC.swift
//  weibo
//
//  Created by 阿城 on 15/12/13.
//  Copyright © 2015年 阿城. All rights reserved.
//

import UIKit

class SCComposeButton: UIButton {

    //关闭高亮
    override var highlighted:Bool{
        get{
            return false
        }
        set{
            
        }
    }
    
    var icon: String?
    var title: String?
    var classname: String?
    
    
    convenience init(dict: [String: AnyObject]) {
        self.init()
        
        setValuesForKeysWithDictionary(dict)
        
        setImage(UIImage(named: icon!), forState: UIControlState.Normal)
        setTitle(title!, forState: UIControlState.Normal)
        
        // 设置内容子控件的一些属性
        titleLabel?.textAlignment = .Center
        titleLabel?.font = UIFont.systemFontOfSize(14)
        setTitleColor(UIColor.darkGrayColor(), forState: UIControlState.Normal)
        // 指定 imageView 的 contentModel
        imageView?.contentMode = .Center

    }
    
    override func layoutSubviews() {
        super.layoutSubviews()
        
        imageView?.x = 0
        imageView?.y = 0
        imageView?.width = width
        imageView?.height = width
        
        titleLabel?.x = 0
        titleLabel?.y = width
        titleLabel?.width = width
    }
    

}
